#pragma once
#include"RBTree.h"

namespace My_set
{
	template<class K>
	class set
	{
		struct SetKeyOfT
		{
			const K& operator()(const K& key)
			{
				return key;
			}
		};
	public:
		typedef typename RBTree<K, const K, SetKeyOfT>::Iterator Iterator;
		typedef typename RBTree<K, const K, SetKeyOfT>::const_Iterator const_Iterator;
		Iterator begin()
		{
			return _t.Begin();
		}

		Iterator end()
		{
			return _t.End();
		}

		const_Iterator begin() const
		{
			return _t.Begin();
		}

		const_Iterator end() const
		{
			return _t.End();
		}
		pair<Iterator, bool> Insert(const K& key)
		{
			return _t.Insert(key);
		}
		void InOrder()
		{
			_t.InOrder();
		}
	private:
		RBTree<K, const K, SetKeyOfT> _t;
	};
	void Test()
	{
		int a[] = { 16, 3, 7, 11, 9, 26, 18, 14, 15 };
		set<int> T;
		for (auto e : a)
		{
			T.Insert(e);
		}
		for (auto e : T)
		{
			cout << e << " ";
		}
	}

}
